******************************************************************DETAILS
/* 	This do-file analyzes the data sets "comm_senti.dta" and "comm_ads.dta" to replicate
	Klingelhoefer (2026) -	A complex cocktail: reappraising the role of 
							positive emotions in the appeal of 
							populist radical right parties */

	
******************************************************************A. Preliminaries 
* Create a folder named "Klingelhoefer 2026 PRX replication" and set as global macro and working directory; here exemplarily:
global file = "C:\Users\abc\Desktop\Klingelhoefer 2026 PRX replication"
cd "$file"
pwd

* load sentiment analysis file file
use "$file\comm_senti.dta", clear

* description of word counts of text collections (Table 2)
bysort mode_num: sum WC

* share of emotion words across collections (first paragraph of "Positive emtional appeals are frequent" section)
mean anger
mean anx
mean posemo
mean negemo

* share of emotion words by collection mode
mean anger, over(mode_num)
mean anx, over(mode_num)
mean posemo, over(mode_num)

* share of emotion words by collection mode (Figure 1)
graph bar anger anx posemo, over(mode_num) ///
	ytitle("Percentage of emotion words") legend(rows(3) label(1 "Anger") label(2 "Anxiety") label(3 "Positive emotions")) ///
	graphregion(color(white)) bar(1, color(gs0)) bar(2, color(gs4)) bar(3, color(gs8)) bar(4, color(gs12))
graph export "$file/Figure 1.tif", width (1240) height(793) replace 


******************************************************************B. Analysis of sentiment (text collections)
* main analysis (Table 4)
reg anger PRRP i.country_num, cluster(pcode)
est sto m11
reg anger PRRP i.country_num i.mode_num, cluster(pcode)
est sto m12
reg anx PRRP i.country_num, cluster(pcode)
est sto m13
reg anx PRRP i.country_num i.mode_num, cluster(pcode)
est sto m14
reg posemo PRRP i.country_num, cluster(pcode)
est sto m15 
reg posemo PRRP i.country_num i.mode_num, cluster(pcode)
est sto m16 

esttab m1* using "$file\Tab 4.rtf", b(2) se(2) ///
	r2(2) ar2(2) star(* 0.10 ** 0.05 *** 0.01) replace

* robustness to mode exclusion (Tables A.2-A.4)
reg anger PRRP i.country_num if mode_num!=1, cluster(pcode)
est sto m21
reg anger PRRP i.country_num if mode_num!=2, cluster(pcode)
est sto m22
reg anger PRRP i.country_num if mode_num!=3, cluster(pcode)
est sto m23
reg anger PRRP i.country_num if mode_num!=4, cluster(pcode)
est sto m24
esttab m2* using "$file\Tab A2 anger.rtf", b(2) se(2) ///
	r2(2) ar2(2) star(* 0.10 ** 0.05 *** 0.01) replace

reg anx PRRP i.country_num if mode_num!=1, cluster(pcode)
est sto m31
reg anx PRRP i.country_num if mode_num!=2, cluster(pcode)
est sto m32
reg anx PRRP i.country_num if mode_num!=3, cluster(pcode)
est sto m33
reg anx PRRP i.country_num if mode_num!=4, cluster(pcode)
est sto m34

esttab m3* using "$file\Tab A3 anxiety.rtf", b(2) se(2) ///
	r2(2) ar2(2) star(* 0.10 ** 0.05 *** 0.01) replace

reg posemo PRRP i.country_num if mode_num!=1, cluster(pcode)
est sto m41
reg posemo PRRP i.country_num if mode_num!=2, cluster(pcode)
est sto m42
reg posemo PRRP i.country_num if mode_num!=3, cluster(pcode)
est sto m43
reg posemo PRRP i.country_num if mode_num!=4, cluster(pcode)
est sto m44

esttab m4* using "$file\Tab A4 posemo.rtf", b(2) se(2) ///
	r2(2) ar2(2) star(* 0.10 ** 0.05 *** 0.01) replace

* robustness: only Austria and Germany (Table A.5)
reg anger PRRP i.country_num if country_num!=3, cluster(pcode)
est sto m51
reg anger PRRP i.country_num i.mode_num if country_num!=3, cluster(pcode)
est sto m52
reg anx PRRP i.country_num if country_num!=3, cluster(pcode)
est sto m53
reg anx PRRP i.country_num i.mode_num if country_num!=3, cluster(pcode)
est sto m54
reg posemo PRRP i.country_num if country_num!=3, cluster(pcode)
est sto m55 
reg posemo PRRP i.country_num i.mode_num if country_num!=3, cluster(pcode)
est sto m56 

esttab m5* using "$file\Tab A5 only AT DE.rtf", b(2) se(2) ///
	r2(2) ar2(2) star(* 0.10 ** 0.05 *** 0.01) replace
	
******************************************************************C. Analysis of emotional appeals in video ads
* Load file
use "$file\comm_ads.dta", clear

* robustness: video ads (Table A.6)
ologit ang_ap PRRP, cluster(pcode)
est sto m61
ologit fea_ap PRRP, cluster(pcode)
est sto m62
ologit sad_ap PRRP, cluster(pcode)
est sto m63
ologit cal_ap PRRP, cluster(pcode)
est sto m64
ologit com_ap PRRP, cluster(pcode)
est sto m65
ologit amu_ap PRRP, cluster(pcode)
est sto m66
ologit pri_ap PRRP, cluster(pcode)
est sto m67
ologit ent_ap PRRP, cluster(pcode)
est sto m68

esttab m6* using "$file\Tab A6 Ads.rtf", b(2) se(2) ///
	pr2(2) star(* 0.10 ** 0.05 *** 0.01) replace

ologit ang_ap PRRP i.country_num, cluster(pcode)
ologit fea_ap PRRP i.country_num, cluster(pcode)
ologit sad_ap PRRP i.country_num, cluster(pcode)
ologit cal_ap PRRP i.country_num, cluster(pcode)
ologit com_ap PRRP i.country_num, cluster(pcode)
ologit amu_ap PRRP i.country_num, cluster(pcode)
ologit pri_ap PRRP i.country_num, cluster(pcode)
ologit ent_ap PRRP i.country_num, cluster(pcode)
